package com.ng.desktop.view.categoria;

import java.awt.Dimension;
import java.util.Arrays;
import java.util.List;

import com.ng.desktop.model.Categoria;
import com.ng.desktop.persistence.CategoriaPersistence;
import com.ng.desktop.services.NGFactoryBean;
import com.ng.framework.persistence.NGSearchParameter.Type;
import com.ng.framework.persistence.NGSearchParameter.UnaryOperation;
import com.ng.framework.view.desktop.NGABMCFrame;
import com.ng.framework.view.desktop.NGGUIUtils;
import com.ng.framework.view.desktop.NGTablePanel;
import com.ng.framework.view.desktop.filters.NGFilter;
import com.ng.framework.view.desktop.filters.NGTextFieldFilter;

public class CategoriaFrame extends NGABMCFrame<Categoria, CategoriaPersistence> {


	private static final long serialVersionUID = -1306560836396996812L;

	public CategoriaFrame() {
		this.setFrameIcon(NGGUIUtils.getImageIcon("icons/tag.png"));
		this.setTitle("Gestión de Categorías");
		this.setSize(new Dimension(600, 600));
		this.centrar();
	}

	@Override
	protected NGTablePanel<Categoria, CategoriaPersistence> createTable(CategoriaPersistence persistence) {
		return new CategoriaTablePanel(persistence);
	}

	@Override
	protected CategoriaPersistence createPersistence() {
		return (CategoriaPersistence) NGFactoryBean.getInstance().getBean("categoriaPersistence");
	}

	@Override
	protected List<NGFilter> createFilters() {
		return Arrays.asList(new NGFilter[] { new NGTextFieldFilter("Nombre", Categoria.class, "nombre", Type.STRING, UnaryOperation.LIKE) });
	}

}
